package com.huiruan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * 收货地址表
 * @TableName address
 */
@TableName(value ="address")
@Data
public class Address extends BaseEntity implements Serializable {
    /**
     * 地址ID
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 收货人姓名
     */
    @NotBlank(message = "收货人不能为空")
    private String receiverName;

    /**
     * 收货人电话
     */
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String receiverPhone;

    /**
     * 省
     */
    private String province;

    /**
     * 市
     */
    private String city;

    /**
     * 区
     */
    private String district;

    /**
     * 详细地址
     */
    private String detailAddress;

    /**
     * 是否默认(0-否 1-是)
     */
    private Byte isDefault;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

}
